home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970326-19970626 / 000240_news@newsmaster….columbia.edu _Tue May 27 12:06:29 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id MAA19913
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Tue, 27 May 1997 12:06:28 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id MAA20268
  7.     for kermit.misc@watsun; Tue, 27 May 1997 12:06:28 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: simple test for controlling terminal?
  12. Date: 27 May 1997 16:06:22 GMT
  13. Organization: Columbia University
  14. Lines: 28
  15. Message-ID: <5mf0pu$jot$1@newsmaster.cc.columbia.edu>
  16. References: <5mctd1$h7f@gateway.dircsa.org.au>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:7085
  19.  
  20. In article <5mctd1$h7f@gateway.dircsa.org.au>,
  21. Arthur Marsh <arthur@gateway.dircsa.org.au> wrote:
  22. : Hi, I do have the fine C-Kermit manual, but wondered what the simplest
  23. : way to get a Kermit script to quit if the script was not run from a serial
  24. : tty. 
  25. That's a good question.  I think the answer would depend on the precise
  26. UNIX version and release and configuration.  In the general case, UNIX
  27. provides no way to tell whether a device is a serial tty or a pseudoterminal.
  28.  
  29. : In other words, what would be the proper C-Kermit script to compare a
  30. : substring to achieve the same result as:
  31. :   if not (first 8 characters of \$(LOGTTY) = "/dev/tty") then quit
  32. But your login tty is always "/dev/tty".  Maybe you have something in the
  33. system-wide profile like:
  34.  
  35.   export LOGTTY=`tty`
  36.  
  37. String comparison, of course, is the easy part:
  38.  
  39.   if not equal "\fsubstring(\$(LOGTTY),1,8)" "/dev/tty" stop 1 blah blah
  40.  
  41. You could do something like make a list of the serial devices on your computer
  42. and then look it up in the list (hint: use arrays).
  43.  
  44. - Frank